package com.foreknow.demo2;

public class Swallow extends Bird {
    //子类中新扩充的方法
    public void fly() {
        System.out.println(this.getName()+" 正在飞翔......");
    }
    public static void main(String[] args) {
        Bird bird = new Bird();
        bird.setName("xxx ");
        bird.eat();
        System.out.println("-----------------------------------");
        Swallow s = new Swallow();
        s.setName("愤怒的小鸟 ");
        s.eat();
        s.fly();
    }
}
